(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  this.AdminBookListingModel = (function(_super) {

    __extends(AdminBookListingModel, _super);

    function AdminBookListingModel() {
      return AdminBookListingModel.__super__.constructor.apply(this, arguments);
    }

    AdminBookListingModel.ListingUrl = '';

    AdminBookListingModel.prototype.initialize = function() {
      if (AdminBookListingModel.ListingUrl.length === 0) {
        return AdminBookListingModel.ListingUrl = SiteMap.Admin.Books.Listing;
      }
    };

    AdminBookListingModel.prototype.defaults = {
      Books: [],
      Column: "Name",
      Size: 10,
      Page: 1,
      Direction: 0,
      Filter: {
        Name: '',
        AuthorId: '',
        AuthorName: '',
        CategoryId: '',
        CategoryName: ''
      }
    };

    AdminBookListingModel.prototype.url = function() {
      var url;
      url = AdminBookListingModel.ListingUrl;
      url += "?page=" + this.attributes.Page;
      url += "&size=" + this.attributes.Size;
      url += "&Column=" + this.attributes.Column;
      url += "&Direction=" + this.attributes.Direction;
      url += "&Filter.Name=" + this.attributes.Filter.Name;
      url += "&Filter.AuthorId=" + this.attributes.Filter.AuthorId;
      url += "&Filter.AuthorName=" + this.attributes.Filter.AuthorName;
      url += "&Filter.CategoryId=" + this.attributes.Filter.CategoryId;
      url += "&Filter.CategoryName=" + this.attributes.Filter.CategoryName;
      SiteMap.Admin.Books.Listing = encodeURI(url);
      return SiteMap.Admin.Books.Listing;
    };

    AdminBookListingModel.prototype.parse = function(response) {
      var attrs;
      attrs = {
        Size: response.Size,
        Page: response.Page,
        TotalPages: response.TotalPages,
        Column: response.Column,
        Direction: response.Direction,
        Filter: this.attributes.Filter
      };
      attrs.Books = response.Books;
      if (response.Filter.Name != null) {
        attrs.Filter.Name = response.Filter.Name;
      }
      if (response.Filter.AuthorId != null) {
        attrs.Filter.AuthorId = response.Filter.AuthorId;
      }
      if (response.Filter.CategoryId != null) {
        attrs.Filter.CategoryId = response.Filter.CategoryId;
      }
      if (response.Filter.AuthorName != null) {
        attrs.Filter.AuthorName = response.Filter.AuthorName;
      }
      if (response.Filter.CategoryName != null) {
        attrs.Filter.CategoryName = response.Filter.CategoryName;
      }
      return attrs;
    };

    return AdminBookListingModel;

  })(ListingModel);

}).call(this);
